import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PayOrderVO, PayOrderQuery } from '@/api/retail/payOrder/types';

/**
 * 查询支付订单列表
 * @param query
 * @returns {*}
 */
export const listPayOrder = (query?: PayOrderQuery): AxiosPromise<PayOrderVO[]> => {
  return request({
    url: '/mall/payOrder/list',
    method: 'get',
    params: query
  });
};

export const paidNotify = (id: string | number | undefined) => {
  return request({
    url: '/mall/payOrder/paidNotify/' + id,
    method: 'get'
  });
};

/**
 *  订单冲正
 **/
export const reversePayOrder = (id: string | number | undefined,validCode: string) => {

  return request({
    url: '/mall/payOrder/reverse/' + id+'/'+validCode,
    method: 'post',
  });
}

/**
 * 查询支付订单详细
 * @param id
 */
export const getPayOrder = (id: string | number): AxiosPromise<PayOrderVO> => {
  return request({
    url: '/mall/payOrder/' + id,
    method: 'get'
  });
};
